package com.crack.nga2.utils;

import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


/**
 * 设置字体大小
 * Created by Administrator on 2016/1/15.
 */
public class FontSizeUtil {
    public static void perform(ViewGroup viewGroup, float scale) {
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View view = viewGroup.getChildAt(i);
            if (view instanceof ViewGroup) {
                ViewGroup group = (ViewGroup) view;
                perform(group, scale);
            } else if (view instanceof TextView) {
                TextView textView = (TextView) view;
                float f = textView.getTextSize();
                f = f * scale;
                textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, f);
            }
        }
    }
}
